<template>
  <div>
    <input id='ipt' v-model="message" type="text">
    <input v-model="message2" type="text">
    <button @click="stop">停止监听</button>
  </div>
</template>

<script setup lang="ts">
import { ref, watchEffect } from 'vue'
let message = ref('')
let message2 = ref('')
const stop=   watchEffect((oninvalidate)=>{
  oninvalidate(()=>{
    console.log('before');
    
  })
  // let iptEnt: HTMLInputElement = document.querySelector('#ipt') as HTMLInputElement
  // console.log(iptEnt);
  console.log(message2.value);
  
},{
  flush:'post',
  onTrigger(e){
  //  debugger
    
  }
})

const stopFun = ()=>stop()
</script>
<style scoped lang='less'>
</style>